package com.ruoyi.subject.util;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.subject.constant.QbSubConstant;

/**
 * @author lzhj
 * @version 1.0.0
 * @className QbSubjectUtil.java
 * @description
 * @date 2021年01月30日 17:22:00
 */
public class QbSubjectUtil {

    /**
     * 微信验证失败提示
     *
     * @return
     */
    public static AjaxResult getWxValidataFailMag() {
        return AjaxResult.error(-1, QbSubConstant.USER_VALIDATA_FAIL_MSG);
    }

    /**
     * 获得考试记录的redis的key
     *
     * @param category
     * @return
     */
    public static String getExamRecordCacheKey(String category) {
        return QbSubConstant.EXAM_RECORD_KEY + category;
    }


    /**
     * 获得小程序练题的抽题规则的redis的key
     *
     * @param category
     * @return
     */
    public static String getSubjectRuleCacheKey(String category) {
        return QbSubConstant.SUBJECT_RULE_KEY + category;
    }


    /**
     * 获得按题库类型，类别，题型  分类的redis的key
     *
     * @param category
     * @param subClass
     * @param subType
     * @return
     */
    public static String getSubjectTypeCacheKey(String category, String subClass, String subType) {
        return QbSubConstant.SUBJECT_CLASS_TYPE_KEY + category + ":" + subClass + ":" + subType;
    }

    /**
     * 获得按题库类型，的redis的key
     * @param category
     * @return
     */
    public static String getSubjectCategoryCacheKey(String category) {
        return QbSubConstant.SUBJECT_CLASS_TYPE_KEY + category + ":*";
    }

}
